package cn.tedu.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/ServletDemo01")
public class ServletDemo01 extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //打印一句话---在idea里看
        System.out.println("欢迎来到Servlet的世界");
        //给浏览器做出响应--在浏览器里看
        response.getWriter().write("hello servlet!!");
        //和daPost（）一样，直接调用上面的方法即可
        doPost(request,response);

    }
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {

        //打印一句话---在idea里看
        System.out.println("欢迎来到Servlet的世界");
        //给浏览器做出响应--在浏览器里看
        response.getWriter().write("hello servlet!!");
    }
}
